<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <f:view contentType="text/html">
        <h:head>
            <f:facet name="first">
                <meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
                <title>Crew Intranet: Véhicule</title>
            </f:facet>
        </h:head> 

        <h:body>
            <ui:composition template="./template.xhtml">
                <ui:define name="top">
                    
                </ui:define>
                <ui:define name="left">
                    <h:form >
                        <p:menu my="true" style="width:200px">
                            <p:submenu label="Navigation Véhicle" >  
                                <p:menuitem value="Les véhicules" action="#{redirectionBean.getRedirectionAccueilVehicule}" icon="ui-icon-home"
                                            styleClass="#{view.viewId == '/accueilVehicule.xhtml' || 
                                                          view.viewId == '/creerUnVehicule.xhtml' || 
                                                          view.viewId == '/editerUnlVehicule.xhtml' ? 'ui-state-active' : ''}"
                                            />  
                            </p:submenu>
                            <p:submenu label="Navigation Catégorie">  
                                <p:menuitem value="Gestion des modèles" action="#{redirectionBean.getRedirectionGestionMarque}" icon="ui-icon-suitcase" 
                                            styleClass="#{ view.viewId == '/gestionMarque.xhtml' ? 'ui-state-active' : ''}"
                                            />  
                            </p:submenu>  
                            <p:submenu label="Navigation Réglage">  
                                 
                            </p:submenu>  
                        </p:menu> 
                    </h:form>
                </ui:define>
                <ui:define name="content">
                    <h:form>

                    </h:form>
                    <h:form id="formListRechVehicule">
                        <p:panel header="Véhcule" style="width: 95%">
                            <f:facet name="header">
                                Les véhicules
                                <p:commandButton id="AjouterUnVehicule" 
                                                 style="float: right;" value="Créer un véhicule" icon="ui-icon-plus"
                                                 action="#{vehiculeCreerBean.creerUnVehicule}">
                                </p:commandButton>

                            </f:facet>
                            
                            <p:dataTable id="dataTable" var="vehicule" value="#{vehiculeBean.listCvVehicules}" widgetVar="vehiculeTable"   
                                         emptyMessage="Pas de véhicule trouvée" filteredValue="#{vehiculeBean.filterListCvVehicules}"
                                         selection="#{vehiculeBean.cvVehiculeSelectionner}" 
                                         paginator="true" rows="10"
                                         rowsPerPageTemplate="5,10,15,30,50"
                                         >  

                                <f:facet name="header">  
                                    <p:outputPanel>  
                                        <h:outputText value="Chercher dans tout les champs:" />  
                                        <p:inputText id="globalFilter" onkeyup="vehiculeTable.filter()" style="width:150px" />  
                                    </p:outputPanel>  
                                </f:facet>  

                                <p:column id="matricule" filterBy="#{vehicule.numeroimatriculation}"   
                                          headerText="Matricule" >   
                                    <h:outputText value="#{vehicule.numeroimatriculation}" />  
                                </p:column>  
                                <p:column id="numerocgg" filterBy="#{vehicule.numerocgg}"   
                                          headerText="Numéro CGG" >   
                                    <h:outputText value="#{vehicule.numerocgg}" />  
                                </p:column>  
                                <p:column id="nom" filterBy="#{vehicule.nom}"   
                                          headerText="Nom" >   
                                    <h:outputText value="#{vehicule.nom}" />  
                                </p:column>  
                                <p:column id="marque" filterBy="#{vehicule.typemodel.cvModelIdmodel.cvMarqueIdmarque.marque}"   
                                          headerText="Marque" >   
                                    <h:outputText value="#{vehicule.typemodel.cvModelIdmodel.cvMarqueIdmarque.marque}" />  
                                </p:column>  
                                <p:column id="modele" filterBy="#{vehicule.typemodel.cvModelIdmodel.model}"   
                                          headerText="Modèle" >   
                                    <h:outputText value="#{vehicule.typemodel.cvModelIdmodel.model}" />  
                                </p:column>  
                                <p:column id="modelType" filterBy="#{vehicule.typemodel.model}"   
                                          headerText="Type Modèle" >   
                                    <h:outputText value="#{vehicule.typemodel.model}" />  
                                </p:column>  
                                <p:column headerText="Action">
                                    <p:commandButton action="#{vehiculeCreerBean.voirDetailDunVehicule}" icon="ui-icon-search" >
                                        <f:setPropertyActionListener value="#{vehicule}" target="#{vehiculeCreerBean.cvVehiculeSelectionner}"/>
                                        
                                    </p:commandButton>
                                </p:column> 
                            </p:dataTable> 
                        </p:panel>
                    </h:form>

                </ui:define>
            </ui:composition>
        </h:body>

    </f:view>
</html>

